import { defineStore } from "pinia"
import { ref } from 'vue'

export const useUserInfoStore = defineStore('userInfo', () => {
  //1.定义用户信息
  const userInfo = ref({})
  
  //2.定义修改用户信息的方法
  const setUserInfo = (newInfo) => {
    userInfo.value = newInfo
  }
  //3.定义清空用户信息的方法
  const removeUserInfo = () => {
    userInfo.value = {}
  }

  return { userInfo, setUserInfo, removeUserInfo }
}, {
  persist: true
})
